<?php
	require_once('sql\sql_functions.php');
	executeSqlScript('sql\tables.sql'); // uses proj4 database and sets up words table
	
	$words = file("words.txt");
	require('private\mysqli_connect.php');
	echo "Inserting words into database: </br>";
	
	foreach($words as $key => $word):
		$word = trim($word);
		if(strcmp($word, "") == 0):
			continue;
		endif;
		$query = "insert into words(word) values('$word')";
		$result = $db->query($query);
		if($result):
			echo "Inserted '$word'. <br/>";
		else:
			echo "Unsuccessful in inserting '$word'. " . $db->error . "<br/>";
		endif;
			
	endforeach;
?>